package com.brillilab.service.core.method.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.brillilab.dao.mapper.method.MethodRecommendReceiveMapper;
import com.brillilab.domain.po.method.MethodRecommendReceive;
import com.brillilab.service.core.method.IMethodRecommendReceiveService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class MethodRecommendReceiveServiceImpl implements IMethodRecommendReceiveService {

    @Resource
    private MethodRecommendReceiveMapper methodRecommendReceiveMapper;

    @Override
    public List<MethodRecommendReceive> selectByLabIdAnLabMemberIdAndState(Long labId,Long labMemberId,Integer state) {
        return methodRecommendReceiveMapper.selectList(
                new LambdaQueryWrapper<MethodRecommendReceive>()
                        .eq(MethodRecommendReceive::getLabId,labId)
                        .eq(MethodRecommendReceive::getLabMemberId,labMemberId)
                        .eq(MethodRecommendReceive::getState,state));
    }

    @Override
    public MethodRecommendReceive selectByLabMemberIdAndRecommendId(Long labMemberId, Long methodRecommendId) {
        return methodRecommendReceiveMapper.selectOne(new LambdaQueryWrapper<MethodRecommendReceive>().eq(MethodRecommendReceive::getLabMemberId,labMemberId).eq(MethodRecommendReceive::getMethodRecommendId,methodRecommendId));
    }
}
